import socket

# 服务器对象
server = socket.socket()

# 绑定
server.bind(('0.0.0.0', 8800))

# 监听
server.listen(5)

while 1:
    # 等待连接
    conn, addr = server.accept()

    # 接收数据
    data = conn.recv(1024)
    print(data)

    response = "HTTP/1.1 200 OK\r\nContent-Type: text/html;charset=utf-8;\r\n\r\n<h2>123</h2>\r\n"

    # 发送数据
    conn.send(response.encode())
    print('响应完毕')

# 关闭
server.close()
